<template>
  <el-dialog
    title="试题审核"
    :visible.sync="showCheckDialog"
    width="30%"
    @close="showCheckDialog"
  >
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="审核结果">
        <el-radio-group v-model="form.check_state">
          <el-radio :label="2">通过</el-radio>
          <el-radio :label="3">不通过</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="审核意见">
        <el-input v-model="form.check_remarks" type="textarea" />
      </el-form-item>
    </el-form>
    <span slot="footer">
      <el-button @click="showCheckDialog = false">取消</el-button>
      <el-button type="primary" @click="btnOK">确定</el-button>
    </span>
  </el-dialog>

</template>

<script>
import { checkStateAPI } from '@/api/question'
export default {
  name: 'CheckStateBank',
  props: {
    checkId: {
      type: [Number, String],
      default: ''
    }
  },
  data() {
    return {
      showCheckDialog: false,
      // 表单数据
      form: {
        check_state: 2,
        check_remarks: ''
      }
    }
  },
  methods: {
    // 点击提交
    async btnOK() {
      // 处理数据
      const checklist = [{ id: this.checkId, ...this.form }]
      await checkStateAPI({
        checklist: checklist
      })
      this.showCheckDialog = false
      this.$message.success('操作成功')
      this.$emit('checkStateTofather')
    }
  }
}
</script>

<style>

</style>
